package  SEApp.components.propertyCtrls {
/* Параметры:

	angle		: угол направления,
	distance	: длина направления от 0 до 1 	
*/
	import UIFree.controls.uif_scrollbar;
	import UIFree.graphicTools.angle.uif_directCtrl;
	import UIFree.uif_component;
	
	import UIUtils.uif_util;
	
	import flash.events.Event;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	public class c_directCtrl extends c_propertyBase {
		public static const WEIGHT: Number = 130;
		
		private var _directCtrl		: uif_directCtrl;
		
		public function c_directCtrl(parent:uif_component, aData:Object, y:Number, a_height:Number) {
			super(parent, aData, y, a_height);
		}
		
		override protected function createComponents():void {
			super.createComponents();
			var rect: Rectangle = componentRect;
			var dwidth: Number = rect.height * 1.8;
			_directCtrl = new uif_directCtrl(this, rect.x + (rect.width - dwidth) / 2, rect.y, dwidth, rect.height, 'directControl');
			_directCtrl.addEvent(Event.CHANGE, doChange);
		}
		
		override protected function setData(value:Object):void {
			super.setData(value);
			_directCtrl.angle = _data.value.angle;
			_directCtrl.length = _data.value.distance;
		}
		
		override protected function getValue(): Object {
			return {
				angle		: _directCtrl.angle,
				distance	: _directCtrl.length
			};
		}
	}
}